package com.flame.ai.pdf.bean;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Jflame
 * @version 1.0.0
 * @since 2025/8/26
 */
@Data
public class ContentItem {
    @JsonProperty("type")
    private String type;

    @JsonProperty("text")
    private String text;

    @JsonProperty("text_level")
    private Integer textLevel;

    @JsonProperty("text_format")
    private String textFormat;

    @JsonProperty("img_path")
    private String imgPath;

    @JsonProperty("image_caption")
    private List<String> imageCaption;

    @JsonProperty("image_footnote")
    private List<String> imageFootnote;

    @JsonProperty("table_caption")
    private List<String> tableCaption;

    @JsonProperty("table_footnote")
    private List<String> tableFootnote;

    @JsonProperty("table_body")
    private String tableBody;

    @JsonProperty("page_idx")
    private Integer pageIdx;


    public void addImageCaption(List<String> caption) {
        if (imageCaption == null) {
            imageCaption = new ArrayList<>();
        }
        imageCaption.addAll(caption);
    }

    public void addImageFootnote(List<String> footnote) {
        if (imageFootnote == null) {
            imageFootnote = new ArrayList<>();
        }
        imageFootnote.addAll(footnote);
    }
}
